#include "CaseUIFactory.hpp"
#include "CaseMainWindow.qth"
#include "DbStorage/SqlSvrConnectionConfig.hpp"
#include "Ctrl/ControlCenter.hpp"
#include "QtUI/SqlSvrConnConfigWidget.qth"
#include "QtUI/DummyConnConfigWidget.qth"
#include "QtUI/DbProjectBrowserWidget.qth"
#include "QtUI/DummyProjectBrowserWidget.qth"

AbsUI::MainWindow* CaseUIFactory::createMainWindow()
{
	return new CaseMainWindow( Ctrl::ControlCenter::instance());
}

// ---------------------------------------------------------------------------------------------------------------------

AbsUI::ConnectionConfigurationWidget* CaseUIFactory::createConnConfigWidget( const std::string& typeName )
{
	if( typeName == DbStorage::SqlSvrConnectionConfig::TYPENAME)
	{
		return new QtUI::SqlSvrConnConfigWidget();
	}
	else
	{
		return new QtUI::DummyConnConfigWidget();
	}
}

// ---------------------------------------------------------------------------------------------------------------------

AbsUI::ProjectBrowserWidget* CaseUIFactory::createProjectBrowserWidget( const Storage::ConnectionConfig& connectionConfig )
{
	if( connectionConfig.typeName() == DbStorage::SqlSvrConnectionConfig::TYPENAME)
	{
		return new QtUI::DbProjectBrowserWidget( connectionConfig.createStorageFactory());
	}
	else
	{
		return new QtUI::DummyProjectBrowserWidget( "");
	}
}
